package cn.sunxyz.idea.demo.proxy;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;

/**
 * Created by yangrd on 2017/5/25.
 */
interface Proxy extends MethodInterceptor {
    Enhancer enhancer = new Enhancer();

    default <T> T getProxy(Class<T> cls) {
        enhancer.setSuperclass(cls);
        enhancer.setCallback(this);
        return (T) enhancer.create();
    }
}
